<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>物流信息</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
	#parse('/headFiles.html')
</head>
<body>
<div class="layui-fluid">
	<input id="oldLogisticsCompanyId" type="hidden" value="$!{logisticsCompanyId}">
   	<div class="layui-form" id="LAY-form">
		<input name="tradeNo" type="hidden" value="$!{tradeNo}">
		<div class="layui-form-item">
			<label class="layui-form-label">发货时间</label>
			<div class="layui-input-block">
				<input type="text" class="layui-input" name="logisticsStartDate"  id='logisticsStartDate' autocomplete="off" placeholder="请输入发货时间">
			</div>
		</div>
   		<div class="layui-form-item">
			<label class="layui-form-label">物流名称</label>
			<div class="layui-input-block">
				<select name="logisticsCompanyId" id="logisticsCompanyId" class="layui-hide" lay-ignore>
					<option value="$!{logisticsCompanyId}">$!{logisticsCompany}</option>
				</select>
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">物流单号</label>
			<div class="layui-input-block">
				<input type="text" class="layui-input" name="logisticsTradeNo" lay-verify="required" placeholder="请输入物流单号" autocomplete="off">
			</div>
		</div>
	    <div class="layui-form-item layui-hide">
	    	<input type="button" lay-submit lay-filter="LAY-form-submit" id="LAY-form-submit" value="确认">
  		</div>
	</div>
</div>
#parse('/footFiles.html')
<script type="text/javascript">
layui.config({
  base: '$!{webRoot}/layuiadmin/'
}).extend({
  index: 'lib/index'
}).use(['index', 'form', 'laydate'],function (){
	var $ = layui.$,form = layui.form, laydate = layui.laydate;
	laydate.render({
		elem: '#logisticsStartDate'
		, range: false
	});

	$('#logisticsCompanyId').select2({
		placeholder: "请选择物流公司",
		theme: 'bootstrap',
		ajax: {
			url: '$!{webRoot}/config/logistics_company/select.data',
			method: 'post',
			delay: 250,
			processResults: function (result) {
				if (result.code == 200) {
					return {
						pagination: {more: result.body.more},
						results: result.body.data || []
					};
				} else {
					return {results: []};
				}
			}
		}
	});

	$('#logisticsCompanyId').on('change',function (e){
		var oldLogisticsCompanyId = $('#oldLogisticsCompanyId').val();
		var logisticsCompanyId = $(this).val();
		if(oldLogisticsCompanyId && oldLogisticsCompanyId != logisticsCompanyId){
			layer.confirm('确定要切换物流公司吗？物流费不重新计算！', {icon: 3, title:'提示'}, function(index){
				layer.close(index);
			},function (){
				$('#logisticsCompanyId').val(oldLogisticsCompanyId);
				$('#logisticsCompanyId').trigger('change');
			});
		}
	});
});
</script>
</body>
</html>